package cn.hunqing.web.dto;

import cn.hunqing.web.entity.Template;

public class TemplateSimpleDto {
	private int templateId;
	private String preview;
	private String name;
	private String subname;
	private int polls;
	public int getTemplateId() {
		return templateId;
	}
	public void setTemplateId(int templateId) {
		this.templateId = templateId;
	}
	public String getPreview() {
		return preview;
	}
	public void setPreview(String preview) {
		this.preview = preview;
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	public String getSubname() {
		return subname;
	}
	public void setSubname(String subname) {
		this.subname = subname;
	}
	public int getPolls() {
		return polls;
	}
	public void setPolls(int polls) {
		this.polls = polls;
	}
	
	public static TemplateSimpleDto buildFrom(Template template){
		if(template == null){
			return null;
		}
		TemplateSimpleDto result = new TemplateSimpleDto();
		result.setTemplateId(template.getId());
		result.setPolls(template.getPolls());
		result.setPreview(template.getPreview());
		result.setName(template.getName());
		result.setSubname(template.getSubname());
		return result;
	}
}
